package com.study.design.model.behaviorPattern.memento;

/**
* @Name: Emp
* @Description: 源发器类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-2-15 下午10:36:09 
* @Version: V1.0
 */
public class Emp {
	
	private String ename ;
	private int age ;
	private double salary ;
	
	/**
	* @Name: memento
	* @Description: 备忘操作：备份当前对象的属性值，并返回备忘录对象
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-2-15 下午10:40:13
	* @Parameters: @return
	* @Return: EmpMemento
	 */
	public EmpMemento memento() {
		return new EmpMemento(this) ;
	}
	
	/**
	* @Name: recovery
	* @Description: 数据恢复：恢复备忘录对象的属性值
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-2-15 下午10:42:11
	* @Parameters: @param empMemento
	* @Return: void
	 */
	public void recovery(EmpMemento empMemento) {
		this.ename = empMemento.getEname() ;
		this.age = empMemento.getAge() ;
		this.salary = empMemento.getSalary() ;
	}
	
	public Emp(String ename, int age, double salary) {
		this.ename = ename;
		this.age = age;
		this.salary = salary;
	}
	
	public String getEname() {
		return ename;
	}
	public void setEname(String ename) {
		this.ename = ename;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public double getSalary() {
		return salary;
	}
	public void setSalary(double salary) {
		this.salary = salary;
	}

	@Override
	public String toString() {
		return "Emp [ename=" + ename + ", age=" + age + ", salary=" + salary
				+ "]";
	}
	
}
